<template>
	<view style="width: 100%;display: flex;">
		<view class="left">
			<manage></manage>
		</view>
		<view style="width: 90%;">
			<uni-search-bar placeholder="搜索订单编号" bgColor="#EEEEEE" @confirm="search" cancelButton="none" />
			<!-- :loading="true" -->
			<uni-table border stripe type="selection" emptyText="暂无更多数据" selection-change="multipleChoose">
				<uni-tr>
				<uni-th align="center" width="60">序号</uni-th>
					<uni-th align="center" >编号</uni-th>
					<uni-th align="center">姓名</uni-th>
					<uni-th align="center" >性别</uni-th>
					<uni-th align="center">年龄</uni-th>
					<uni-th align="center" >身份证号码</uni-th>
					<uni-th align="center">手机号</uni-th>
					<uni-th align="center" >邮箱</uni-th>
					<uni-th align="center">家庭住址</uni-th>
					<uni-th align="center" >职位</uni-th>
					<uni-th align="center">图片</uni-th>
					<uni-th align="center" >密码</uni-th>
					<uni-th align="center">入职时间</uni-th>
					<uni-th align="center" >状态</uni-th>
					<uni-th align="center" >操作</uni-th>
					<uni-th align="center" ></uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in uers" :key="index">
						<uni-td align="center">{{index}}</uni-td>
					<uni-td align="center">{{item.uersId}}</uni-td>
					<uni-td align="center">{{item.uersname}}</uni-td>
					<uni-td align="center">{{item.sex}}</uni-td>
					<uni-td align="center">{{item.age}}</uni-td>
					<uni-td align="center">{{item.identity}}</uni-td>
					<uni-td align="center">{{item.phone}}</uni-td>
					<uni-td align="center">{{item.email}}</uni-td>
					<uni-td align="center">{{item.address}}</uni-td>
					<uni-td align="center">{{item.position}}</uni-td>
					<uni-td align="center">{{item.imger}}</uni-td>
					<uni-td align="center">{{item.passwodr}}</uni-td>
					<uni-td align="center">{{item.time}}</uni-td>
					<uni-td align="center">{{item.staic}}</uni-td>
				<uni-td>
					<view class="uni-group">
						<button class="uni-button" size="mini" type="primary" @click="edit(index)">修改</button>
						<button class="uni-button" size="mini" type="warn" @click="del(index)">删除</button>
					</view>
				</uni-td>	</uni-tr>
		<!-- 		 <uni-tr v-for="(item, index) in uers" :key="index">
						<uni-td align="center">
							<checkbox></checkbox>
						</uni-td>
						<uni-td>{{t}}</uni-td>
				</uni-tr> -->
			</uni-table>
			<view>
				<uni-row>
					<uni-col :span="3" class="grid">
						<button type="primary" icon="uni-icon-circle-plus-outline" size="mini"
							@click="inputDialogToggle" class="uni-button" width="30px">新增
						</button>
					</uni-col>
					<uni-col :span="3" class="grid">
						<button type="warn" icon="uni-icon-delete" size="mini" @click="delSelect"
							class="uni-button" width="30px">删除
						</button>
					</uni-col>
				</uni-row>
			</view>
			<br />
			<!-- <uni-pagination :total="50" title="标题文字" /> -->
			<!--分页条-->
			<uni-pagination background layout="prev, pager, next" :total="page.totalRecords" :page-size="page.pageSize"
				@current-change="currentChange()">
			</uni-pagination>
		</view>
	</view>
</template>

<script>
	import manage from "@/components/manage/manage.vue";
	export default {
		components: {
			manage,
		},
	data() {
		return {
			intxt:'',
			uers: [],
							page: {
								pageSize: 10, //每页条数,  默认10条
								totalRecords: 0, //总条数
								totalPages: 0, //总页数
								pageNum: 0,
							},
							current:0
		}
	},
	mounted() {
			this.page.totalRecords = this.uers.length;
			this.page.totalPages = this.page.totalRecords / this.page.pageSize + 1;
		},
	methods:{
		selectintxy(name){
			console.log(name)
			for(let i=0;i<this.uers.length;i++){
				if(uers[i].uersname!==name){
				  uers[i].remove()
				}
			}
		},
		edit(index){
			var item=JSON.stringify(this.uers[index]);
		  uni.navigateTo({
		    url:'/pages/addUers/addUers?item='+item,
		    
		  })
		},
		radioChange: function(evt) {
			for (let i = 0; i < this.items.length; i++) {
				if (this.items[i].value === evt.detail.value) {
					this.current = i;
					break;
				}
			}
		},
		select() {
			uni.chooseImage({
				count: 1,
				success: (rst) => {
					// 设置url的值，显示控件
					this.addgForm.imgurl = rst.tempFilePaths[0];
				}
			});
		},
		// // 每页显示多少条数据
		sizeChange(val) {
			this.page.pageSize = val;
		},
		//翻页
		currentChange(val) {
			this.page.pageNum = val - 1;
		},
		getUers() {
			uni.request({
				url: this.api.GetUers,
				method: "GET",
			}).then(data => {
				let [err, res] = data
				this.uers = res.data
				console.log(this.uers)
			})
		},
	},
	onLoad() {
		this.getUers()
	}
	}
</script>
<style scoped>
	.uni-group {
		display: flex;
		align-items: center;
		margin-top: 10px;
	}

	.left {
		border: 1px solid;
		background-color: #c5c5c5;
		height: 100%;
		width: 10 %;
	}

	.rec {
		float: left;
		width: 75%;
		/* height: 100%; */

	}


	input {
		border: 1px solid;
		border-radius: 18px;
	}

	uni-button {
		font-size: 7px;
		border-radius: 18px;
	}

	.table {
		width: 100%;
		border: 1px solid;
		text-align: center;
	}

	.uni-th {
		/* border: #000000 1px solid; */
		/* background-color: #c5c5c5; */
	}

	uni-td {
		align-items: center;
	}

	.button-edu {
		background-color: #18BC37;
	}

	.button-del {
		background-color: #c00000;
	}

	.scroll-Y {
		height: 600px+;
	}
</style>
